package com.accenture.adf.newcodington.module12.sample;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * 
 * Topic: Try-it using the List data type from the Java collection framework
 * 
 * Instructions:
 * 1. Create a 'ListTryIt' class
 * 2. Create a main() method that will perform the following functions
 *    a. Create a list using the ArrayList constructor
 *    b. Populate the list with several elements using the add() method
 *    c. Print all the elements of the list using the Iterator
 *    
 */

public class ListTryIt {

	
	public static void main(String[] args) {
		// Code to create a list of names. Use ArrayList.
		List list=new ArrayList();
		list.add("Sasha");
		list.add("John");
		list.add("Stacie");
		list.add("Mike");
		list.add("Peter");
				
		// Code to print this list
		// Notice the order in which elements get printed.
		for(Iterator iterator=list.iterator();iterator.hasNext();)
		{
			System.out.println("Elements :"+iterator.next());
		}		
	}
}
